class AddZhuiTianYaToEveryOne < ActiveRecord::Migration
  def self.up
    zhui_tian_ya = Tool.find_by_code('zhui_tian_ya')
    User.all.each do |user|
      UserToolSetting::ZhuiTianYa.create!(
        :user_id => user.id,
        :tool_id => zhui_tian_ya.id,
        :column => 1
      ) if UserToolSetting::ZhuiTianYa.find_by_user_id_and_tool_id(user.id,zhui_tian_ya.id).nil?
    end
  end

  def self.down
    UserToolSetting::ZhuiTianYa.delete_all
  end
end
